GNU (Also known as GNU/Hurd)

Installing GNU

This has been contributed by Bruno Bonfils (asyd at debian-fr dot org)

Introduction

Since I don't have enough computers to dedicate a box to GNU, I'm trying to do my own harddrive image disk. I thougt there was some documentation about how to do that. But since I didn't find anything and I decided to write a small doc. I hope this document will be useful for some people who wants to try the GNU/Hurd.

The testing box

Debian (Sid) GNU/Linux 2.4.19 

ii  bochs          1.4.1.no.elpin IA-32 (x86) PC emulator
ii  bochs-x        1.4.1.no.elpin Bochs binary with X interface.
ii  grub           0.92+cvs200209 GRand Unified Bootloader
ii  gcc-i386-gnu   1.7-8          Cheap cross-compiler for GNU/Hurd.
ii  mig-i386-gnu   1.2-1          The GNU distribution of the Mach 3.0 interface
If you don't have time and if you trust me, you can download here [1] my own image file. (You don't need to run native-install)

Creating the image

Note: In this example, I use a 112 MB image disk, but I think you can use any size without some problem.

Use createdisk command like this :
# createdisk gnu.img 112 

Disk Geometry:
C: 227
H: 16
S: 63
Total size: 117153792 bytes

Note on a paper or on your memory the disk geometry. Then, use the losetup command to create a loopback on the whole disk.
# losetup /dev/loop1 gnu.img

Now, call fdisk on /dev/loop1. Go into expert mode, and modify the disk geometry using the c, h, s commands. Return in normal mode, and create an unique primary partition which uses the whole disk. Then, detach the /dev/loop1 using :
# losetup -d /dev/loop1

Installing GNU

  • Attach the partition

    First of all, you need to create a filesystem on the disk. Use the command losetup and -o <offset> option to attach /dev/loop1 on the first partition of an image disk. Offset is computed like this :

    offset = sector * block_size (512)
    # losetup -o 32256 /dev/loop1 gnu.img

  • Preparing the filesystem

    According to the GNU/Hurd Installation Guide [2] , use mke2fs to create a filesystem.
    # mke2fs -o hurd /dev/loop1
    Just mount /dev/loop1 like a typical dev.
    # mount /dev/loop1 /mnt/gnu

  • Finish the installation

    Download a GNU archive as indicated in the Hurd Installation Guide, and decompress it in /mnt/gnu.
    # cd /mnt/gnu
    # tar --same-owner -xvzpf ~/gnu-latest.tar.gz

Bochs Configuration

Copy default configuration (/usr/share/doc/bochs/examples/bochsrc.gz on debian) on your home directory and edit it with your favorite editor (GNU Emacs, i hope ;).

For my image file I have the following configuration :
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000
megs: 128
vgaromimage: /usr/share/vgabios/vgabios.bin
floppya: 1_44=/dev/fd0, status=ejected
diskc: file="/home/asyd/travail/hurd/gnu.img", cyl=227, heads=16, spt=63 # edit me
cdromd: dev=/dev/cdrom, status=inserted
boot: c
log: /dev/stdout
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
vga_update_interval: 300000
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
floppy_command_delay: 500
ips: 1000000
mouse: enabled=0
private_colormap: enabled=0
fullscreen: enabled=0
screenmode: name="sample"
ne2k: ioaddr=0x280, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
keyboard_mapping: enabled=0, map=
keyboard_type: xt
i440fxsupport: enabled=0
note most of them are actually in the default Debian example file. If you use these lines, don't forget to read the Networking section.

Note on GNU Mach

Remember that the Hurd is not a kernel, it's just a collection of libraries and programs, so we can't actually boot the Hurd. We boot GNU Mach, and then launch the base servers.

The default GNU Mach which is provided by the default GNU archive contains some modules / drivers which are not needed in bochs environment. If you use it, you'll probably have some kernel panic while booting. Don't be afraid and just say alwayscont.

Note: in my archive, I use a recompiled GNU Mach which contains only the drivers which are needed (--enable-floppy --enable-ide --enable-kmsg --enable-ne2000). If you want more informations on how to compile your own GNU Mach, just send me a mail and I'll add the section in this document.

Final Step

Create a grub floppy disk or use my floppy image [3] Adapt your bochsrc file according to your choice. If you want install Grub on the image disk, remember to copy stage1, stage2 Grub's files into /mnt/gnu/boot/grub.

Launch bochs - as root if you want networking (using sudo for example).

If you have stage1 and stage2 file, you can install Grub on the MBR.
<grub> root (hd0,0)
<grub> setup (hd0)

Finally, booting GNU mach
<grub> root (hd0,0)
<grub> kernel /boot/gnumach.gz root=hd0s1
<grub> module /boot/serverboot.gz
<grub> boot
Now, you can read the official GNU/Hurd Installation Guide [4] .

Networking

You can try to test networking between the GNU/Linux (host OS) and the GNU/Hurd. First of all, please read [5] , I currently have the *same* problem. [6]

Verify your kernel configuration, you need to have :
CONFIG_NETLINK_DEV=m
CONFIG_ETHERTAP=m
(or y instead or m). Check if /dev/tap0 file exist, else create it with
# mknod /dev/tap0 c 36 16
and run this command on the guest os :
# ifconfig tap0 192.168.100.1 netmask 255.255.255.0
Use ip 196.168.100.10 on the GNU/Hurd and you can ping 192.168.100.1

Thanks

  • Mmenal

  • #hurdfr, #hurd, #bochs channels (Freenode network)

  • All people who help me everyday on IRC

Copyright (c) Bruno Bonfils

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation.

Notes

[1]

My own harddisk Image File (~20Mo)

[2]

GNU/Hurd Installation guide

[3]

Grub Floppy image : (coming soon)

[4]

GNU/Hurd Installation guide

[5]

new ethertap interface for linux, by Bryce Denney

[6]

This can be solved by using the tuntap interface (see the Section called Configuring and using a tuntap network interface in Chapter 8)